<?php session_start();
include "constants.php";
$link = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD); 

if (!$link) { 
    die('Could not connect: ' . mysql_error()); 
} 
mysql_select_db(DB_NAME);

//Create Multiple Payments Table
$sql = "CREATE TABLE IF NOT EXISTS MULTIPAYMENTS(MID INT NOT NULL AUTO_INCREMENT PRIMARY KEY,ACCOUNTID INT NOT NULL,
		PAYDAY VARCHAR(10) NOT NULL, PADDAY VARCHAR(10) NOT NULL,PAIDAMOUNT DOUBLE DEFAULT 0,STATUS INT NOT NULL,EMPLOYEE VARCHAR(20) NULL)";
$result = mysql_query($sql,$link);  	

$sql = "SELECT * FROM MULTIPAYMENTS";
$result = mysql_query($sql,$link);  	
$NAPPLICATION=mysql_num_rows($result);
if($NAPPLICATION==0) {
$sql = "INSERT INTO MULTIPAYMENTS(ACCOUNTID,PAYDAY,PADDAY,PAIDAMOUNT,STATUS,EMPLOYEE)
		VALUES (1,'01/01/2000','01/01/2000',120,2,'TEST')";
$result = mysql_query($sql,$link);  	

$sql = "SELECT * FROM MULTIPAYMENTS";
$result = mysql_query($sql,$link);  	
$NAPPLICATION=mysql_num_rows($result);

}


?>


<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<body>


<--Set up Multiple Payments table-->
<?php if ($NAPPLICATION!=0) { ?>

<p>The Multiple Payments table has been set up successfully</p>

<?php } ?>

<?php if ($NAPPLICATION==0) { ?>

<p>Sorry, the Multiple Payments Table has not been set up yet</p>

<?php } ?>




</body>
</html>